home *** CD-ROM | disk | FTP | other *** search
Wrap
GW-BASIC | 1984-08-01 | 9.3 KB | 108 lines
10 '"Guess the States and Capitals". J. Edward Volkstorf, Jr.,Copyright (c) 1984. 20 CLS:DEF SEG = 0: WIDTH 80: IF (PEEK(&H410) AND &H30)=&H30 THEN BEEP: LOCATE 1,1:PRINT "Program requires a Color/Graphics adapter":END 30 KEY OFF:CLS:SCREEN 0,1:COLOR 7,0:WIDTH 80:LOCATE,,0:CLEAR:DEFINT A-Z:RANDOMIZE VAL(MID$(TIME$,4,2)+RIGHT$(TIME$,2)):DEF FNRB$(N)=MID$(STR$(N),2):FOR K=1 TO 10:KEY K,"":NEXT:DEF SEG=&HB800:GOSUB 1540:IF AP THEN AD=1 110 DEF SEG=&H8000:GOSUB 1540:IF AP THEN AD=AD+2 120 IF AD=0 THEN BEEP:BEEP:BEEP:END 130 IF AD=2 THEN BEEP:PRINT"Program requires color/graphics adapter":END 140 IF AD=3 THEN DEF SEG=0:POKE &H410,(PEEK(&H410)AND &HCF)OR &H10 150 DEF SEG:DIM STN$(50),STC$(50),STL$(50),STP$(50),STD$(50),G(50),PA$(50):N$=CHR$(0):BS$=CHR$(8):ESC$=CHR$(27):ENT$=CHR$(13):CL$=N$+CHR$(75):CR$=N$+CHR$(77):INS$=N$+CHR$(82):DEL$=N$+CHR$(83):CSC=2:CSH=1:BSC=0:BSH=2:CL=-1:SC=CSC:SH=CSH:MAP$="BM72,26 310 PAL=1:BKG=0:TG=50:TG$="50":G=0 360 G=0:GS=0:GS1=0:GC=0:GC1=0:CLS:SCREEN 1,0:COLOR BKG,PAL:LINE(3,3)-(316,156),3,B:LINE(4,4)-(315,155),3,B:LOCATE 2,6:PRINT"Guess the States and Capitals":LOCATE 6,4:PRINT"F1 - Use color F2 - Black/white";:P1=0:P2=3:IF CL THEN P1=3:P2=0 450 GOSUB 1620:LOCATE 9,4:PRINT"F3 - How many states -> ";TG$:LOCATE 12,4:PRINT"F9 - Begin game F10 - End game";:LOCATE 16,8:PRINT"Press desired function key";:LOCATE 22,11:PRINT"Copyright (c) 1984";:LOCATE 24,8:PRINT"by J. Edward Volkstorf, Jr."; 540 ONKEY(1)GOSUB1600:KEY(1)ON:ONKEY(2)GOSUB1610:KEY(2)ON:ONKEY(3)GOSUB1630:KEY(3)ON:ONKEY(9)GOSUB1670:KEY(9)ON:ONKEY(10)GOSUB1680:KEY(10)ON 600 C$=INKEY$:GOTO600 660 RESTORE:CLS:COLORBKG,PAL:DRAW"S4 BM24,0":FORI=1TO50:READSTN$(I),STC$(I),STD$(I):DRAW"Xmap$; C3 Xstd$(i);":PAINTSTEP(0,0),SC,3:NEXT:LOCATE1,1:PRINT"NUMBER STATES CAPITALS":PRINT"SHOWN 720 LOCATE19,11:PRINT"STATE?";:LOCATE21,9:PRINT"CAPITAL?"; 760 RS=INT(RND*50)+1:FORI=1TOG:IFG(I)=RSTHEN760 ELSENEXT 780 DRAW"Xmap$; C3 Xstd$(rs);":PAINTSTEP(0,0),SH,3:ML=14:ED=1:A=0:TR=0:ROW=19:COL=20:G$=STN$(RS):S$="":LOCATEROW,COL:PRINTSPACE$(22) 840 A$=SPACE$(ML):MID$(A$,1)=S$:GOSUB1760:IFC$=ESC$THENLOCATEROW,COL:PRINTSPC(ML);:GOTO840 860 ST$=A$:GOSUB1970:IFERANDTR=1THEN840 870 IFERTHENE$="Sorry. This state is "+G$:A=A+1 ELSEE$="Good! Your answer is correct 880 ER=1:GOSUB2220:IFA=0THENGS=GS+1:GS1=GS1-(TR>0) 890 LOCATE2,17:PRINTFNRB$(GS);" (";FNRB$(GS-GS1);"/";FNRB$(GS1);")";:TR=0:ROW=21:COL=20:G$=STC$(RS):S$="":LOCATEROW,COL:PRINTSPACE$(22) 940 A$=SPACE$(ML):MID$(A$,1)=S$:GOSUB1760:IFC$=ESC$THENLOCATEROW,COL:PRINTSPC(ML);:GOTO940 960 CA$=A$:GOSUB1970:IFERANDTR=1THEN940 970 IFERTHENE$="Sorry. The capital is "+G$:A=A+2 ELSEIFATHENE$="Good! Your answer is correct" ELSEE$="Very good! Both answers are correct. 980 ER=1:GOSUB2220:IF(AAND2)=0THENGC=GC+1:GC1=GC1-(TR>0) 990 LOCATE2,31:PRINTFNRB$(GC);" (";FNRB$(GC-GC1);"/";FNRB$(GC1);")";:G=G+1:G(G)=RS:LOCATE2,7:PRINTFNRB$(G);:IFA>0THENPA$(G)=ST$+","+CA$ 1050 LOCATE25,8:PRINT"Press any key to continue";:GOSUB2140:R=23:GOSUB2185:LOCATE19,20:PRINTSPC(18);:LOCATE21,20:PRINTSPC(18);:DRAW"Xmap$; C3 Xstd$(rs);":PAINTSTEP(0,0),SC,3:IFG<>TGTHEN760 1130 R=19:GOSUB2185:DRAW"Xmap$; C3 Xstd$(rs);":PAINTSTEP(+0,+0),SC,3:GT=G:G=0:IFGT<>GSORGT<>GCTHEN1170 1160 GOSUB2185:LOCATE20,2:PRINT"VERY GOOD! You got them all correct!":GOTO1370 1170 LOCATE22,5:PRINT"Want to see what you missed (Y/N)?";:GOSUB2140:IFC$="N"ORC$="n"THEN1360 ELSEIFC$<>"Y"ANDC$<>"y"THEN1170 1190 LOCATE22,1:PRINTSPC(39);:LOCATE18,4:PRINT"State and capital:";:LOCATE20,1:PRINTSPC(39);:LOCATE20,4:PRINT"Your answers were:";:LOCATE21,4:PRINTSPC(36):FORI=1TOGT:K=G(I):IFPA$(I)=""THEN1350 1270 DRAW"Xmap$; C3 Xstd$(K);":PAINTSTEP(0,0),SH,3:LOCATE19,10:PRINTSTN$(K);",";STC$(K);:LOCATE21,10:PRINTPA$(I);:LOCATE23,7:PRINT"Press any key to continue";:GOSUB2140:LOCATE23,7:PRINTSPC(32);:LOCATE21,10:PRINTSPC(29); 1330 LOCATE19,10:PRINTSPC(29);:DRAW"Xmap$; C3 Xstd$(k);":PAINTSTEP(0,0),SC,3 1350 NEXT 1360 R=18:GOSUB2185 1370 LOCATE22,7:PRINT"Want to play again (Y/N)?";:GOSUB2140:IFC$="Y"ORC$="y"THENFORI=1TO50:PA$(I)="":NEXT:GOTO360 1390 IFC$<>"N"ANDC$<>"n"THENBEEP:GOTO1370 1430 KEY1,"LIST ":KEY2,"RUN"+CHR$(13):KEY3,"LOAD"+CHR$(34):KEY4,"SAVE"+CHR$(34):KEY5,"CONT"+CHR$(13):KEY6,",LPT1:"+CHR$(13):KEY7,"TRON"+CHR$(13):KEY8,"TROFF"+CHR$(13):KEY9,"KEY ":KEY10,"SCREEN 0,0,0"+CHR$(13) 1480 SCREEN0,0,0:COLOR7,0,0:WIDTH80:KEYON:CLS:PRINT"STATES AND CAPITALS GAME OVER":PRINT:END 1540 B=PEEK(0):C=(B+1)MOD256:POKE0,C:D=PEEK(0):POKE0,B:AP=(D=C):RETURN 1600 CL=-1:SC=CSC:SH=CSH:P1=3:P2=0:GOTO1620 1610 CL=0:SC=BSC:SH=BSH:P1=0:P2=3 1620 LINE(20,36)-STEP(21,14),P1,B:LINE(164,36)-STEP(21,14),P2,B:RETURN 1630 ROW=9:COL=28:A$=TG$:ML=2:ED=2:KEY(9)OFF:KEY(10)OFF 1650 GOSUB1760:N=VAL(A$):IFN<1ORN>50THENBEEP:GOTO1650 1660 TG=N:TG$=A$:KEY(9)ON:KEY(10)ON:RETURN 1670 FORI=1TO3:KEY(I)OFF:NEXT:KEY(9)OFF:RETURN660 1680 GOSUB2180:LOCATE25,13:PRINT"END GAME (Y/N)?";:KEY(10)OFF:GOSUB2140:LOCATE25,9:PRINTSPC(23);:IFC$="N"ORC$="n"THENKEY(10)ON:RETURN 1710 IFC$<>"Y"ANDC$<>"y"THENBEEP:GOTO1680 1720 IFG>0THENRETURN1130 ELSERETURN1430 1760 KS=0:P=1:LOCATEROW,COL:A$=SPACE$(LEN(A$)):PRINTA$ 1770 KS=(KS+1)MOD16:T$=MID$(A$,P,1):IFKS>7THENT$="_ 1780 LOCATEROW,COL+P-1:PRINTT$;:C$=INKEY$:IFC$=""THEN1770 ELSELOCATEROW,COL+P-1:PRINTMID$(A$,P,1); 1800 IFERTHENE$="":GOSUB2220:ER=0 1810 IFC$=CL$THENP=P+(P>1):GOTO1770 1820 IFC$=CR$THENP=P-(P<ML):GOTO1770 1830 IFC$=INS$THENT$=" "+MID$(A$,P,ML-P):A$=MID$(A$,1,P-1)+T$:GOTO1780 1840 IFC$=DEL$THENT$=MID$(A$,P+1,ML-P)+" ":A$=MID$(A$,1,P-1)+T$:GOTO1780 1850 IFC$=BS$ANDP>1THENT$=MID$(A$,P,ML-P+1)+" ":A$=MID$(A$,1,P-2)+T$:P=P-1:GOTO1780 1860 IFC$=ENT$ORC$=ESC$THEN1910 1870 C=ASC(C$):IFC>96ANDC<123THENC=C-32:C$=CHR$(C) 1880 IFEDAND1THENIFNOT(C=32OR(C>64ANDC<91))THENBEEP:GOTO1770 1890 IFEDAND2THENIFNOT(C>47ANDC<58)THENBEEP:GOTO1770 1900 MID$(A$,P,1)=C$:LOCATEROW,COL+P-1:PRINTC$;:P=P-(P<ML):GOTO1770 1910 IFEDAND2THENRETURN ELSEIFA$=SPACE$(ML)THENBEEP:GOTO1770 1920 S$=A$:I=LEN(A$):WHILEMID$(A$,I,1)=" "ANDI>1:I=I-1:WEND:A$=MID$(A$,1,I):I=1:WHILEMID$(A$,I,1)=" ":I=I+1:WEND:A$=MID$(A$,I):RETURN 1970 ER=0:IFA$=G$THENRETURN 1980 L1=LEN(A$):L2=LEN(G$):IFABS(L1-L2)<=2THEN2000 1990 E$="INCORRECT ANSWER - TRY AGAIN":GOTO2090 2000 FORC=1TO3:P1=1:P2=1:F=0:FORY=1TOL2:IFMID$(A$,P1,1)=MID$(G$,P2,1)THENP1=P1+1:P2=P2+1 ELSEF=F+1:P1=P1-(C=1ORC=3):P2=P2-(C=1ORC=2) 2035 IFMID$(A$,P1+1,1)=MID$(G$,P2,1)THENP1=P1+1:F=1:GOTO2060 2040 IFMID$(A$,P1,1)=MID$(G$,P2+1,1)THENP2=P2+1:F=1:GOTO2060 2050 F=2 2060 NEXTY:NEXTC:IFF=1THEN2080 2075 IFF=2THEN1990 2080 E$="CHECK YOUR SPELLING AND TRY AGAIN 2090 ER=-1:TR=TR+1:IFTR=1THENGOSUB2220 2100 RETURN 2140 C$="":WHILEC$="":C$=INKEY$:WEND:RETURN 2180 R=23:FORI=RTO25:LOCATEI,1:PRINTSPC(39);:NEXT:RETURN 2185 FORI=RTO25:LOCATEI,1:PRINTSPC(39);:NEXT:RETURN 2220 LOCATE23,1:PRINTSPC(39);:LOCATE23,20-LEN(E$)\2:PRINTE$;:RETURN 2260 DATAALABAMA,MONTGOMERY, "BM+140,+68 R17 D19 L7 D4 M-5,-1 L5 U22 BM+2,+2":DATAALASKA,JUNEAU 2280 DATA"BM-48,+10 M+6,-3M+4,+2M+10,+2M+4,+2M+2,+20M+7,+2M+1,+6M+2,+1D5M-4,-2M-2,-8M-6,-2L4M-2,-2L2M-1,+2M-5,+3U2M+2,-3M-6,+3M+1,+3M-8,+3M-10,+2M+7,-2M+8,-4M-4,-4M+1,-4L2M-1,-4M+4,-4M-5,-4M+3,-8 BM+4,+6 2290 DATAARIZONA,PHOENIX, "BM+34,+56 R22 D24 M-10,+2 M-12,-2 U24 BM+1,+1":DATAARKANSAS,LITTLE ROCK,"BM+111,+60 R22 M-5,+8 M-3,+10 L12 U2 M-2,-1 U15 BM+1,+1 2310 DATACALIFORNIA,SACRAMENTO, "BM+0,+32 R15 D16 M+19,+14 D18 L9 M-15,-16 L4 M-6,-24 U8 BM+1,+1":DATACOLORADO,DENVER, "BM+56,+36 R28 D20 L28 U20 BM+1,+1":DATACONNECTICUT,HARTFORD, "BM+205,+30 R6 M+1,+4 M-7,+1 U5 BM+1,+1 2340 DATADELAWARE,DOVER, "BM+200,+47 M+5,+3 M-1,+2 L4 U5 BM+1,+2":DATAFLORIDA,TALLAHASSEE, "BM+150,+87 R7 D2 R17 U2 R6 M+7,+11 M-3,+10 L4 M-5,-6 U4 M-10,-6 M-5,+3 M-10,-4 U4 BM+1,+1 2360 DATAGEORGIA,ATLANTA, "BM+157,+68 R13M+12,+14M-2,+5L6 D2 L17 U21 BM+1,+1":DATAHAWAII,HONOLULU 2380 DATA"BM-48,+72 BM+0,+1 M+2,-1M+2,+1M-1,+2L3U2 BM+10,+5R1M+1,-1M+1,+3L2M-1,-2 BM+8,+4R3M-1,+1L2U1 BM+7,+4M+1,-1R3D2M-2,+1M-1,-2M-3,-1 BM+7,+8M+2,-2 U2M+5,+4M+1,+2M-3,+1M-2,+2M-2,-1M-1,-4 BM+2,+2 2390 DATAIDAHO,BOISE, "BM+25,+0 R7 D8 M+14,+10 D14 L18 U14 L3 U18 BM+1,+1":DATAILLINOIS,SPRINGFIELD, "BM+125,+28 R11 M+4,+4 D21 M-6,+1 M-13,-18 M+4,-4 U4 BM+1,+1":DATAINDIANA,INDIANAPOLIS, "BM+140,+32 R12D17M-10,+5 M-2,-1 U21 BM+1,+1 2420 DATAIOWA,DES MOINES, "BM+102,+24 R21M+2,+4D4M-4,+4L15M-4,-10 U2 BM+1,+1":DATAKANSAS,TOPEKA, "BM+84,+40 R22 M+5,+4 D12 L27 U16 BM+1,+1":DATAKENTUCKY,FRANKFORT, "BM+134,+54 M+6,-1 M+2,+1 M+10,-5 M+8,+3 M+7,+6 M-5,+2 L29 M+1,-6 BM+2,+2 2450 DATALOUISIANA,BATON ROUGE,"BM+113,+78 R12 M+2,+4 M-3,+4 R6 M+3,+9 M-20,-6 U11 BM+1,+1":DATAMAINE,AUGUSTA, "BM+218,+4 M+4,+2 M+2,+10 M-5,+2 M-3,+6 L1 M-2,-10 M+5,-10 BM+1,+2 2470 DATAMARYLAND,ANNAPOLIS, "BM+178,+44 R16 M+6,+3 D5 R4 M-2,+4 M-8,-4 M-1,-4 M-3,+2 M-5,-1 U3 L7 U2 BM+1,+1":DATAMASSACHUSETTS,BOSTON, "BM+205,+24 R11 M-1,+6 L10 U6 BM+1,+1 2490 DATAMICHIGAN,LANSING, "BM+125,+9 M+13,-6 D3 R12 M-1,+2 M+1,+1 R4 M+3,+9 M+3,+6 M-3,+8 L17 M+5,-8 M-3,-6 M+3,-4 M+1,+1 M+2,-5 M-1,-1 L7 M-4,+5 M-3,-5 L8 BM+8,-2":DATAMINNESOTA,ST PAUL, "BM+102,+0 R15 M+3,+3 M-6,+5 D8 M+9,+8 L21 U24 BM+1,+1 2510 DATAMISSISSIPPI,JACKSON, "BM+128,+68 R12 D22 M-8,+2 M-2,-6 L6 M+3,-4 M-2,-4 M+3,-10 BM+1,+1":DATAMISSOURI,JEFFERSON CITY,"BM+106,+36 R15 M+13,+18 M-1,+6 L22 U16 M-5,-4 U4 BM+1,+1":DATAMONTANA,HELENA, "BM+32,+0 R42 D18 L28 M-14,-10 U8 BM+1,+1 2540 DATANEBRASKA,LINCOLN,"BM+74,+26 R28 M+4,+10 D4 L22 U4 L10 U10 BM+1,+1":DATANEVADA,CARSON CITY, " BM+15,+32 R19 D30 M-19,-14 U16 BM+1,+1":DATANEW HAMPSHIRE,CONCORD, "BM+210,+14 R3 M+2,+10 L6 M+1,-10 BM+1,+1 2570 DATANEW JERSEY,TRENTON, "BM+200,+36 M+6,+2 M-1,+10 M-5,-1 M-6,-3 M+6,-4 U4 BM+1,+2":DATANEW MEXICO,SANTA FE, "BM+56,+56 R22 D22 L13 D2 L9 U24 BM+1,+1 2590 DATANEW YORK,ALBANY, "BM+176,+28 M+4,-3 R5 M+5,-7 M+10,-3 R5 D20 M+1,+3 M-6,-2 M-5,-1 U3 L19 U4 BM+2,+0":DATANORTH CAROLINA,RALEIGH, "BM+170,+60 R30 M-12,+12 M-6,-6 L10 M-2,+2 L10 M+10,-8 BM+2,+2 2610 DATANORTH DAKOTA,BISMARCK, "BM+74,+0 R28 D14 L28 U14 BM+1,+1":DATAOHIO,COLUMBUS, "BM+152,+32 R18 D12 M-10,+8 M-8,-3 U17 BM+1,+1":DATAOKLAHOMA,OKLAHOMA CITY, "BM+78,+56 R33D19M-20,-5U10 L13 U4 BM+1,+1 2640 DATAOREGON,SALEM, "BM+4,+14 M+3,+2 R18 D2 R3 D14 L28 U16 M+4,-2 BM+0,+2":DATAPENNSYLVANIA,HARRISBURG, "BM+170,+32 M+6,-4 D4 R19 D3 M+5,+1 D4 M-6,+4 L24 U12 BM+1,+0":DATARHODE ISLAND,PROVIDENCE, "BM+211,+30 R4 D4 L3 M-1,-4 BM+1,+1 2670 DATASOUTH CAROLINA,COLUMBIA, "BM+172,+66 R10 M+6,+6 M-6,+10 M-12,-14 M+2,-2 BM+2,+2":DATASOUTH DAKOTA,PIERRE, "BM+74,+14 R28 D12 L28 U12 BM+1,+1":DATATENNESSEE,NASHVILLE, "BM+133,+60 R37 M-10,+8 L32 M+5,-8 BM+1,+2 2700 DATATEXAS,AUSTIN, "BM+78,+60 R13 D10 M+22,+6 D13 M-9,+5 D12 M-9,-6 M-8,-12 L7 D2 L5 M-10,-10 U2 R13 U18 BM+1,+1":DATAUTAH,SALT LAKE CITY, "BM+34,+32 R12 D4 R10 D20 L22 U24 BM+1,+1":DATAVERMONT,MONTPELIER , "BM+205,+15 R5 M-1,+9 L4 U9 BM+1,+1 2730 DATAVIRGINIA , RICHMOND , "BM+162,+60 M+5,-2 M+13,-5 M+2,-5 M+3,+1 M+5,+1 M+3,-2 M+1,+4 M+6,+8 L38 BM+6,-1":DATAWASHINGTON,OLYMPIA, "BM+8,+0 R17 D16 L18 M-3,-2 U10 R4 U4 BM+1,+1 2750 DATAWEST VIRGINIA,CHARLESTON, "BM+170,+44 R8 D2 R7 D3 M-3,-1 M-2,+5 M-13,+5 M-7,-6 M+10,-8 BM+2,+2":DATAWISCONSIN,MADISON, "BM+114,+8 R6 D2 M+3,-2 M+2,+1 R8 M+3,+5 D14 L11 M-2,-4 M-9,-8 U8 BM+1,+1 2770 DATAWYOMING,CHEYENNE, "BM+46,+18 R28 D18 L28 U18 BM+1,+1":SCREEN1:CLS:RESTORE2260:FORI=1TO50:READS$,C$,D$:LOCATE1,1:PRINTSPC(39);:LOCATE1,1:PRINTS$;" ";C$:DRAW"BM72,32 c3 xD$;":PAINTSTEP(0,0),2,3:G$=INPUT$(1):NEXT 2790 BEEP:G$=INPUT$(1):SCREEN0:WIDTH80:END